<%@page import="com.seminariosab.tools.SABSeedRamdomize"%>
<%@page import="com.seminariosab.entys.SABRepresentanteEnty"%>
<%@page import="com.seminariosab.tools.SABConstantine"%>
<%@page import="java.util.List"%>
<%@page import="com.seminariosab.entys.SABCallsEnty,java.util.Collection,com.seminariosab.SABObject"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<jsp:useBean id="SABEntyDao" class="com.seminariosab.daos.SABEntyDao" scope="session" ></jsp:useBean>
<jsp:useBean id="SABUtil" class="com.seminariosab.tools.SABUtil" scope="session" ></jsp:useBean>    
<%
String cod_operador=null;
SABRepresentanteEnty enty=null;
try{
    cod_operador=request.getParameter("codoperador");
    
}catch(Exception ex){
    cod_operador=null;
}

try{
    enty=(SABRepresentanteEnty)request.getSession().getAttribute(SABConstantine.SABWebOpeObject);
    
}catch(Exception ex){
    cod_operador=null;
}

if(enty!=null){
    cod_operador=enty.getCod_operador();
}
List<SABCallsEnty> lstCalls=(List<SABCallsEnty>)SABEntyDao.getCallsByRepresentante("019", "3063", "2013-02-01");
if(enty == null){
	response.sendRedirect(SABConstantine.SABURLinit);
}
%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>SISAB - Asignacion de llamadas</title>
        <link href="styles/cstyle_sab01.css" rel="stylesheet" type="text/css">
        <script src="SpryAssets/SpryValidationCheckbox.js" type="text/javascript"></script>
        <link href="SpryAssets/SpryValidationCheckbox.css" rel="stylesheet" type="text/css">
</head>
    <body> 
    <center>
    <form action="doasignacion" method="post" name="frmasignacion" target="_self" id="frmasignacion">
    <table width="1024" border="0" cellpadding="0" cellspacing="0" class="cstyle_sab01">
	  <!--DWLayoutTable-->
	  <tr>
	    <td width="88" rowspan="4" valign="middle" bgcolor="#B8CCE0"><div align="left"><ul>
        <%
        String pth="/var/spool/asterisk/monitor/";

        for(String st: SABUtil.getFoldersNonRecursiveByPath(pth)){
            %><li />
            <a href="#" class="t_header_link"><%=st.toString()%></a>
            <%
        }
        
	%> </ul>
        </div></td>
        <td height="27" colspan="14" valign="top" bgcolor="#B8CCE0" class="t_header"><strong>Registro de llamadas - SISAB : <%= enty.getDesc_operador() +"("+enty.getUser()+")" %></strong></td>
      </tr>
	  <tr>
	    <td width="40" height="33" valign="top" background="images/barasig_top.jpg"  class="t_header"><div align="left"><a href="#"><img src="images/btnasig_consutlar.jpg" alt="Cosultar" width="39" height="33" border="0" onClick="hija=openFinder('fopen.jsp'); return false;"></a></div></td>
      <td width="9" valign="top" background="images/barasig_top.jpg"><!--DWLayoutEmptyCell-->&nbsp;</td>
      <td colspan="2" valign="top" background="images/barasig_top.jpg"><div align="left"><a href="#"><img src="images/btnasig_guardar.jpg" border="0" alt="Guardar" width="39" height="33"></a></div></td>
      <td width="48">&nbsp;</td>
      <td width="30">&nbsp;</td>
      <td width="60">&nbsp;</td>
      <td width="16">&nbsp;</td>
      <td width="60">&nbsp;</td>
      <td width="60">&nbsp;</td>
      <td width="183">&nbsp;</td>
      <td width="119">&nbsp;</td>
      <td width="56">&nbsp;</td>
      <td width="212">&nbsp;</td>
	  </tr>
	  <tr>
	    <td height="14" colspan="4" valign="top" bgcolor="#CCCCCC"  class="t_header"><!--DWLayoutEmptyCell-->&nbsp;</td>
	    <td valign="top" bgcolor="#CCCCCC"  class="t_header"><!--DWLayoutEmptyCell-->&nbsp;</td>
	    <td colspan="3" valign="top" bgcolor="#CCCCCC"  class="t_header"><!--DWLayoutEmptyCell-->&nbsp;</td>
	    <td valign="top" bgcolor="#CCCCCC"  class="t_header"><!--DWLayoutEmptyCell-->&nbsp;</td>
	    <td valign="top" bgcolor="#CCCCCC"  class="t_header"><!--DWLayoutEmptyCell-->&nbsp;</td>
	    <td valign="top" bgcolor="#CCCCCC"><!--DWLayoutEmptyCell-->&nbsp;</td>
	    <td valign="top" bgcolor="#CCCCCC" class="t_header"><!--DWLayoutEmptyCell-->&nbsp;</td>
      <td valign="top" bgcolor="#CCCCCC" class="t_header"><!--DWLayoutEmptyCell-->&nbsp;</td>
      <td></td>
	  </tr>
	  <tr>
	    <td height="14" colspan="2" valign="top" bgcolor="#CCCCCC"  class="t_header"><strong>&nbsp;Fecha</strong></td>
        <td width="36" valign="top" bgcolor="#CCCCCC"  class="t_header"><strong>&nbsp;Hora</strong></td>
	    <td colspan="3" valign="top" bgcolor="#CCCCCC"  class="t_header"><strong>&nbsp;Ent./Salien.</strong></td>
	    <td valign="top" bgcolor="#CCCCCC"  class="t_header">&nbsp;<strong>Cliente</strong></td>
	    <td></td>
	    <td></td>
	    <td valign="top" bgcolor="#CCCCCC"  class="t_header"><strong>Tel&eacute;fono</strong></td>
	    <td valign="top" bgcolor="#CCCCCC"><strong>&nbsp;Nombre o Razón Social</strong></td>
	    <td valign="top" bgcolor="#CCCCCC" class="t_header"><div align="center"><strong>&nbsp;Enviar a SMV</strong></div></td>
      <td valign="top" bgcolor="#CCCCCC" class="t_header"><!--DWLayoutEmptyCell-->&nbsp;</td>
	  <td></td>
	  </tr>
      <%
      if(lstCalls.size()>0){
          int step=0;
          for(SABCallsEnty ent : lstCalls){
      %>
      <tr>
	    <td height="22">&nbsp;</td>
            <td colspan="2" valign="top"><input value="<%= ent.getFecha_operacion() %>" name="txtfecha<%=step%>" type="text" id="txtfecha<%=step%>" size="6" onKeyPress="return dotab(event,this);"></td>
	        <td valign="top"><input value="<%= ent.getSetHoraOperacion() %>" name="txthora<%=step%>" type="text" id="txthora<%=step%>" size="4" onKeyPress="return dotab(event,this);"></td>
        <td colspan="3" valign="top"><div align="center">
          <input style="font-weight:bold" value='<%=(ent.getNombrearchivo().contains("e")?"Entrante":"Saliente")%>' name="txtentrantesaliente<%=step%>" type="text" id="txtentrantesaliente<%=step%>" size="4" onKeyPress="return dotab(event,this);">
        </div></td>
        <td valign="top"><input value="" name="txtcosabcli<%=step%>" type="text" id="txtcosabcli<%=step%>" size="10" onKeyDown="return dof2(event, this);" onKeyPress="return dotab(event,this);"></td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td valign="top"><input value="<%= ent.getTelefono() %>" name="txttelefono<%=step%>" type="text" id="txttelefono<%=step%>" size="10" onKeyPress="return dotab(event,this);"></td>
	    <td valign="top"><input value="<%= ent.getNombrearchivo() %>" name="txtdescli<%=step%>" type="text" id="txtdescli<%=step%>" size="30" onKeyPress="return dotab(event,this);"></td>
        
	    <td align="center" valign="top" ><span id="sprycheckbox1">
	      <label>
	      <input name="cb_enviarsmv" type="checkbox" id="cb_enviarsmv" value="S" onKeyPress="return dotab(event,this);">
	      </label>
        <span class="checkboxRequiredMsg">Realice una selección.</span></span></td>
      <td valign="top" align="center" style="background:url(images/hphones.jpg); background-repeat:no-repeat;" ><div align="center"><a href="#" class="t_header_link" onClick="child=window.open('<%="fpreview.jsp?"+(SABConstantine.SABWebObjectValue)+"&urlfile="+ ent.getNombrearchivo() %>');"><strong> ver </strong></a></div></td>
      <td >&nbsp;</td>
      </tr>
     <%
     step++;
             }
      }
     %>  
	  <tr>
	    <td height="63"></td>
	    <td></td>
	    <td></td>
	    <td></td>
	    <td width="9"></td>
	    <td></td>
	    <td></td>
	    <td></td>
	    <td></td>
	    <td></td>
	    <td></td>
	    <td></td>
	    <td></td>
	    <td></td>
        <td></td>
	  </tr>
    </table>
    </form>
    </center>
    <script type="text/javascript">
<!--
var sprycheckbox1 = new Spry.Widget.ValidationCheckbox("sprycheckbox1");
//-->
    </script>
    <script type="text/javascript">
	<!---
	function dotab(e,obj)
	{
                tecla=(document.all) ? e.keyCode : e.which;
                if(tecla!=13) return;
                frm=obj.form;
                for(i=0;i<frm.elements.length;i++)
                    if(frm.elements[i]==obj) {
                        if (i==frm.elements.length-1) i=-1;
                        break }
                if(frm.elements[i+1].type=="hidden"){i++;}
                frm.elements[i+1].focus();
                if(frm.elements[i+1].type=="text"){
                    frm.elements[i+1].select();
                }
                return false;
            }

	//-->
	<!--
	function dof2(e,obj)
	{
                var teclaf2=(document.all) ? e.keyCode : e.which;				
                if(teclaf2!=113) return;
				if(teclaf2 == 113){
					window.open("fopen.jsp");
				}
                return false;
            }
	//-->
    </script>
    <script>
	<!---
	function openFinder(url){
		win=window;
		var str="jsjsjsjsjjsj.jsp?url=kskskskskl";
		var params=""+<%= "\"?"+new SABSeedRamdomize().getSeed()+"&codop="+ enty.getCod_operador()+"\"" %>+"";
		child=window.open(url+params,"asignacionwchild","height=300,width=420,status=no,scrollbars=yes,toolbar=no,menubar=no,location=no,top=250, left=320");
	}
	//-->
    </script>
</body>
</html>
